package graph;

import java.util.Random;


public class GraphTest {
	
	public void runTest() {
		int[][] testMap = generateBlankMap(25, 25);
		long startingTime = System.nanoTime();
		Graph graph = GraphFactory.generateGraphFrom(testMap);
		long spentTime = System.nanoTime() - startingTime;
		
		printMap(testMap);
		System.out.println("Creating a graph took " + (spentTime / 1000000) + " ms.");
		System.out.println("Nodes: " + graph.getNodes().size());
		System.out.println("Edges: " + graph.getEdges().size());
	}
	
	public int[][] generateBlankMap(int rows, int columns) {
		Random random = new Random();
		int[][] map = new int[rows][columns];
		
		for(int rowIndex = 0; rowIndex < map.length; rowIndex ++) {
			for(int columnIndex = 0; columnIndex < map[0].length; columnIndex ++) {
				map[rowIndex][columnIndex] = 0;
			}
		}

		return map;
	}
	
	public void printMap(int[][] map) {
		System.out.println("Map: ");
		for(int rowIndex = 0; rowIndex < map.length; rowIndex ++) {
			for(int columnIndex = 0; columnIndex < map[0].length; columnIndex ++) {
				System.out.print(map[rowIndex][columnIndex]);
			}
			System.out.println();
		}
	}

	
	public static void main(String[] args) {
		new GraphTest().runTest();
	}
	
}
